#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QProgressBar>
#include <QTimer>
#include <QPushButton>
#include <QThread>

class Worker : public QObject {
    Q_OBJECT

public slots:
    void doWork() {
        for (int i = 0; i <= 100; ++i) {
            // 模拟耗时操作
            QThread::msleep(50); // 模拟工作进度的间隔
            emit progressChanged(i);
        }
        QThread::currentThread()->quit();
    }
signals:
    void progressChanged(int value);
};


QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    MainWindow(QWidget* parent = nullptr);
    ~MainWindow();
private slots:
    void startTask();
private:
    QProgressBar *progressBar;
    Worker* worker = new Worker;
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
